home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 3_2004-2005.ISO / Data / Zips / Remote_Win1827201292004.psc / Remote Winamp / source / client / frmclient.frm (.txt) next >
Encoding:
Visual Basic Form  |  2004-12-09  |  24.8 KB  |  826 lines

  1. VERSION 5.00
  2. Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0"; "COMCTL32.OCX"
  3. Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"
  4. Begin VB.Form frmclient 
  5.    BorderStyle     =   1  'Fixed Single
  6.    Caption         =   "Status: Disconnected"
  7.    ClientHeight    =   7350
  8.    ClientLeft      =   300
  9.    ClientTop       =   2025
  10.    ClientWidth     =   8295
  11.    ClipControls    =   0   'False
  12.    ControlBox      =   0   'False
  13.    BeginProperty Font 
  14.       Name            =   "Tahoma"
  15.       Size            =   8.25
  16.       Charset         =   0
  17.       Weight          =   400
  18.       Underline       =   0   'False
  19.       Italic          =   0   'False
  20.       Strikethrough   =   0   'False
  21.    EndProperty
  22.    Icon            =   "frmclient.frx":0000
  23.    KeyPreview      =   -1  'True
  24.    LinkTopic       =   "Form2"
  25.    MaxButton       =   0   'False
  26.    MinButton       =   0   'False
  27.    ScaleHeight     =   7350
  28.    ScaleWidth      =   8295
  29.    StartUpPosition =   2  'CenterScreen
  30.    Begin VB.CommandButton cmdPauseTrans 
  31.       Caption         =   "Pause Transmitting Signals (To prevent detection)"
  32.       Height          =   315
  33.       Left            =   360
  34.       TabIndex        =   3
  35.       Top             =   1170
  36.       Width           =   4635
  37.    End
  38.    Begin VB.CommandButton cmdDownload 
  39.       Caption         =   "Download"
  40.       Height          =   315
  41.       Left            =   6540
  42.       TabIndex        =   29
  43.       Top             =   6600
  44.       Width           =   1395
  45.    End
  46.    Begin VB.CommandButton cmdIPScan 
  47.       Caption         =   "Scan for LAN Users in Local Network"
  48.       Height          =   315
  49.       Left            =   360
  50.       TabIndex        =   2
  51.       Top             =   800
  52.       Width           =   4635
  53.    End
  54.    Begin ComctlLib.Slider sldVol 
  55.       Height          =   255
  56.       Left            =   1620
  57.       TabIndex        =   6
  58.       Top             =   2280
  59.       Width           =   1155
  60.       _ExtentX        =   2037
  61.       _ExtentY        =   450
  62.       _Version        =   327682
  63.       LargeChange     =   10
  64.       Max             =   255
  65.       SelStart        =   127
  66.       TickStyle       =   3
  67.       Value           =   127
  68.    End
  69.    Begin VB.CommandButton cmdBrowse 
  70.       Caption         =   "Browse"
  71.       Height          =   315
  72.       Left            =   3510
  73.       TabIndex        =   25
  74.       Top             =   6600
  75.       Width           =   915
  76.    End
  77.    Begin VB.CommandButton cmdshowPlaylist 
  78.       Caption         =   "PL"
  79.       Height          =   375
  80.       Left            =   7570
  81.       TabIndex        =   33
  82.       Top             =   5760
  83.       Width           =   375
  84.    End
  85.    Begin VB.CommandButton cmdfind 
  86.       Caption         =   "Search"
  87.       Height          =   375
  88.       Left            =   6540
  89.       TabIndex        =   32
  90.       Top             =   5760
  91.       Width           =   1000
  92.    End
  93.    Begin VB.CommandButton cmdReplace 
  94.       Caption         =   "Replace"
  95.       Height          =   315
  96.       Left            =   4460
  97.       TabIndex        =   27
  98.       Top             =   6600
  99.       Width           =   915
  100.    End
  101.    Begin VB.CommandButton cmdaddfile 
  102.       Caption         =   "Add to PL"
  103.       Height          =   315
  104.       Left            =   5400
  105.       TabIndex        =   28
  106.       Top             =   6600
  107.       Width           =   915
  108.    End
  109.    Begin VB.CommandButton Command3 
  110.       Caption         =   "Modify Remote Winamp Path"
  111.       Height          =   375
  112.       Left            =   5520
  113.       TabIndex        =   18
  114.       Top             =   1200
  115.       Width           =   2535
  116.    End
  117.    Begin VB.CommandButton Command6 
  118.       Caption         =   "&Connect"
  119.       Default         =   -1  'True
  120.       Height          =   315
  121.       Left            =   3240
  122.       TabIndex        =   1
  123.       ToolTipText     =   "Connect/Disconnect"
  124.       Top             =   420
  125.       Width           =   1755
  126.    End
  127.    Begin VB.CommandButton cmdTerminateCL 
  128.       Caption         =   "Terminate RW Client"
  129.       Height          =   375
  130.       Left            =   5520
  131.       TabIndex        =   17
  132.       Top             =   600
  133.       Width           =   2535
  134.    End
  135.    Begin VB.CommandButton cmdCloseRW 
  136.       Caption         =   "Terminate RW Server"
  137.       Height          =   375
  138.       Left            =   5520
  139.       TabIndex        =   16
  140.       Top             =   195
  141.       Width           =   2535
  142.    End
  143.    Begin VB.CommandButton cmdActions 
  144.       Caption         =   "Previous Track"
  145.       Height          =   375
  146.       Index           =   0
  147.       Left            =   240
  148.       TabIndex        =   10
  149.       Top             =   3360
  150.       Width           =   1335
  151.    End
  152.    Begin VB.CommandButton cmdActions 
  153.       Caption         =   "Next Track"
  154.       Height          =   375
  155.       Index           =   1
  156.       Left            =   3840
  157.       TabIndex        =   14
  158.       Top             =   2955
  159.       Width           =   1335
  160.    End
  161.    Begin VB.CommandButton cmdActions 
  162.       Caption         =   "Play"
  163.       Height          =   375
  164.       Index           =   2
  165.       Left            =   1710
  166.       TabIndex        =   11
  167.       Top             =   3120
  168.       Width           =   650
  169.    End
  170.    Begin VB.CommandButton cmdActions 
  171.       Caption         =   "Pause"
  172.       Height          =   375
  173.       Index           =   3
  174.       Left            =   2400
  175.       TabIndex        =   12
  176.       Top             =   3120
  177.       Width           =   650
  178.    End
  179.    Begin VB.CommandButton cmdActions 
  180.       Caption         =   "Stop"
  181.       Height          =   375
  182.       Index           =   4
  183.       Left            =   3090
  184.       TabIndex        =   13
  185.       Top             =   3120
  186.       Width           =   650
  187.    End
  188.    Begin VB.CommandButton Command4 
  189.       Caption         =   "Exit Remote Winamp"
  190.       Height          =   375
  191.       Left            =   5520
  192.       TabIndex        =   23
  193.       Top             =   3480
  194.       Width           =   2535
  195.    End
  196.    Begin VB.Frame Frame1 
  197.       Caption         =   " Built-in Browser (Search for files remotely) "
  198.       BeginProperty Font 
  199.          Name            =   "Tahoma"
  200.          Size            =   8.25
  201.          Charset         =   0
  202.          Weight          =   700
  203.          Underline       =   0   'False
  204.          Italic          =   0   'False
  205.          Strikethrough   =   0   'False
  206.       EndProperty
  207.       Height          =   3195
  208.       Left            =   120
  209.       TabIndex        =   36
  210.       Top             =   3960
  211.       Width           =   8055
  212.       Begin VB.ComboBox cmbdblclick 
  213.          Height          =   315
  214.          ItemData        =   "frmclient.frx":08CA
  215.          Left            =   6400
  216.          List            =   "frmclient.frx":08D7
  217.          Style           =   2  'Dropdown List
  218.          TabIndex        =   30
  219.          Top             =   600
  220.          Width           =   1455
  221.       End
  222.       Begin VB.ComboBox cmbFiletype 
  223.          Height          =   315
  224.          ItemData        =   "frmclient.frx":08F1
  225.          Left            =   6400
  226.          List            =   "frmclient.frx":090D
  227.          TabIndex        =   31
  228.          Text            =   "*.*"
  229.          Top             =   1320
  230.          Width           =   1455
  231.       End
  232.       Begin VB.TextBox txtselfile 
  233.          Height          =   285
  234.          Left            =   1320
  235.          TabIndex        =   24
  236.          Top             =   2660
  237.          Width           =   1995
  238.       End
  239.       Begin VB.ListBox lstfiles 
  240.          Height          =   2205
  241.          Left            =   120
  242.          TabIndex        =   26
  243.          Top             =   360
  244.          Width           =   6135
  245.       End
  246.       Begin VB.Label Label6 
  247.          Alignment       =   2  'Center
  248.          BackStyle       =   0  'Transparent
  249.          Caption         =   "Browse for:"
  250.          Height          =   255
  251.          Left            =   6360
  252.          TabIndex        =   42
  253.          Top             =   1080
  254.          Width           =   1515
  255.       End
  256.       Begin VB.Label Label3 
  257.          Alignment       =   2  'Center
  258.          BackStyle       =   0  'Transparent
  259.          Caption         =   "Double-click Action:"
  260.          Height          =   255
  261.          Left            =   6360
  262.          TabIndex        =   41
  263.          Top             =   360
  264.          Width           =   1515
  265.       End
  266.       Begin VB.Label Label5 
  267.          Alignment       =   1  'Right Justify
  268.          BackStyle       =   0  'Transparent
  269.          Caption         =   "Remote Path:"
  270.          Height          =   255
  271.          Left            =   120
  272.          TabIndex        =   40
  273.          Top             =   2700
  274.          Width           =   1095
  275.       End
  276.    End
  277.    Begin VB.Timer Timer1 
  278.       Enabled         =   0   'False
  279.       Interval        =   1
  280.       Left            =   5040
  281.       Top             =   1080
  282.    End
  283.    Begin VB.CommandButton cmdActions 
  284.       Caption         =   "First Track"
  285.       Height          =   375
  286.       Index           =   9
  287.       Left            =   240
  288.       TabIndex        =   9
  289.       Top             =   2955
  290.       Width           =   1335
  291.    End
  292.    Begin VB.CommandButton cmdActions 
  293.       Caption         =   "Last Track"
  294.       Height          =   375
  295.       Index           =   10
  296.       Left            =   3840
  297.       TabIndex        =   15
  298.       ToolTipText     =   "Last Track"
  299.       Top             =   3360
  300.       Width           =   1335
  301.    End
  302.    Begin VB.CommandButton cmdActions 
  303.       Caption         =   "Clear Remote Winamp Playlist"
  304.       Height          =   375
  305.       Index           =   7
  306.       Left            =   5520
  307.       TabIndex        =   19
  308.       Top             =   1605
  309.       Width           =   2535
  310.    End
  311.    Begin VB.Timer Timer2 
  312.       Interval        =   133
  313.       Left            =   5040
  314.       Top             =   1560
  315.    End
  316.    Begin VB.CommandButton Command9 
  317.       Caption         =   "Minimise Remote Winamp"
  318.       Height          =   375
  319.       Left            =   5520
  320.       TabIndex        =   21
  321.       Top             =   2640
  322.       Width           =   2535
  323.    End
  324.    Begin VB.CommandButton Command10 
  325.       Caption         =   "Restore Remote Winamp"
  326.       Height          =   375
  327.       Left            =   5520
  328.       TabIndex        =   22
  329.       Top             =   3045
  330.       Width           =   2535
  331.    End
  332.    Begin VB.CommandButton cmdActions 
  333.       Caption         =   "Remote Winamp Visualisation"
  334.       Height          =   375
  335.       Index           =   8
  336.       Left            =   5520
  337.       TabIndex        =   20
  338.       Top             =   2010
  339.       Width           =   2535
  340.    End
  341.    Begin VB.CommandButton cmdActions 
  342.       Caption         =   "Shuffle"
  343.       Height          =   375
  344.       Index           =   6
  345.       Left            =   240
  346.       TabIndex        =   4
  347.       Top             =   1920
  348.       Width           =   1215
  349.    End
  350.    Begin VB.CommandButton cmdActions 
  351.       Caption         =   "Repeat"
  352.       Height          =   375
  353.       Index           =   5
  354.       Left            =   240
  355.       TabIndex        =   5
  356.       Top             =   2325
  357.       Width           =   1215
  358.    End
  359.    Begin VB.CommandButton Command8 
  360.       Caption         =   "Center the Balance"
  361.       Height          =   785
  362.       Left            =   3960
  363.       TabIndex        =   8
  364.       Top             =   1920
  365.       Width           =   1215
  366.    End
  367.    Begin VB.Frame Frame2 
  368.       Caption         =   " Configure Remote Connection "
  369.       BeginProperty Font 
  370.          Name            =   "Tahoma"
  371.          Size            =   8.25
  372.          Charset         =   0
  373.          Weight          =   700
  374.          Underline       =   0   'False
  375.          Italic          =   0   'False
  376.          Strikethrough   =   0   'False
  377.       EndProperty
  378.       Height          =   1515
  379.       Left            =   120
  380.       TabIndex        =   35
  381.       Top             =   120
  382.       Width           =   5175
  383.       Begin VB.TextBox txtIP 
  384.          Height          =   285
  385.          Left            =   1080
  386.          TabIndex        =   0
  387.          Text            =   "127.0.0.1"
  388.          Top             =   320
  389.          Width           =   1935
  390.       End
  391.       Begin VB.Label Label4 
  392.          Alignment       =   1  'Right Justify
  393.          BackStyle       =   0  'Transparent
  394.          Caption         =   "Server IP:"
  395.          Height          =   255
  396.          Left            =   120
  397.          TabIndex        =   39
  398.          Top             =   360
  399.          Width           =   855
  400.       End
  401.    End
  402.    Begin VB.PictureBox pictray 
  403.       Height          =   315
  404.       Left            =   4560
  405.       ScaleHeight     =   255
  406.       ScaleWidth      =   435
  407.       TabIndex        =   34
  408.       Top             =   1080
  409.       Visible         =   0   'False
  410.       Width           =   495
  411.    End
  412.    Begin MSWinsockLib.Winsock Winsock1 
  413.       Left            =   5040
  414.       Top             =   2040
  415.       _ExtentX        =   741
  416.       _ExtentY        =   741
  417.       _Version        =   393216
  418.    End
  419.    Begin ComctlLib.Slider sldBal 
  420.       Height          =   255
  421.       Left            =   3000
  422.       TabIndex        =   7
  423.       Top             =   2280
  424.       Width           =   795
  425.       _ExtentX        =   1402
  426.       _ExtentY        =   450
  427.       _Version        =   327682
  428.       LargeChange     =   10
  429.       Max             =   255
  430.       SelStart        =   127
  431.       TickStyle       =   3
  432.       Value           =   127
  433.    End
  434.    Begin VB.Label Label2 
  435.       Alignment       =   2  'Center
  436.       BackStyle       =   0  'Transparent
  437.       Caption         =   "Balance"
  438.       BeginProperty Font 
  439.          Name            =   "Tahoma"
  440.          Size            =   8.25
  441.          Charset         =   0
  442.          Weight          =   700
  443.          Underline       =   0   'False
  444.          Italic          =   0   'False
  445.          Strikethrough   =   0   'False
  446.       EndProperty
  447.       ForeColor       =   &H00946934&
  448.       Height          =   255
  449.       Left            =   3000
  450.       TabIndex        =   38
  451.       Top             =   2040
  452.       Width           =   795
  453.    End
  454.    Begin VB.Label Label1 
  455.       Alignment       =   2  'Center
  456.       BackStyle       =   0  'Transparent
  457.       Caption         =   "Volume"
  458.       BeginProperty Font 
  459.          Name            =   "Tahoma"
  460.          Size            =   8.25
  461.          Charset         =   0
  462.          Weight          =   700
  463.          Underline       =   0   'False
  464.          Italic          =   0   'False
  465.          Strikethrough   =   0   'False
  466.       EndProperty
  467.       ForeColor       =   &H000040C0&
  468.       Height          =   210
  469.       Left            =   1650
  470.       TabIndex        =   37
  471.       Top             =   2040
  472.       Width           =   1095
  473.    End
  474. Attribute VB_Name = "frmclient"
  475. Attribute VB_GlobalNameSpace = False
  476. Attribute VB_Creatable = False
  477. Attribute VB_PredeclaredId = True
  478. Attribute VB_Exposed = False
  479. Option Explicit
  480. Dim winamppath As String
  481. Dim PlNum As Long, PlTot As Long, songtime As Long, SongName As String
  482. Private Function RemoveParent(ByVal File As String) As String
  483. Dim t As Long
  484. If Right(File, 1) = "\" Then File = Mid(File, 1, Len(File) - 1)
  485. For t = Len(File) To 1 Step -1
  486. If Mid(File, t, 1) = "\" Then
  487.     RemoveParent = Mid(File, t + 1)
  488.     Exit Function
  489. End If
  490. Next t
  491. End Function
  492. Private Function RemoveFileName(ByVal File As String) As String
  493. Dim t As Long
  494. If Right(File, 1) = "\" Then File = Mid(File, 1, Len(File) - 1)
  495. For t = Len(File) To 1 Step -1
  496. If Mid(File, t, 1) = "\" Then
  497.     RemoveFileName = Left(File, t)
  498.     Exit Function
  499. End If
  500. Next t
  501. End Function
  502. Private Sub cmdActions_Click(Index As Integer)
  503. Select Case Index
  504. Case 0
  505. SendData "PREV"
  506. Case 1
  507. SendData "NEXT"
  508. Case 2
  509. SendData "PLAY"
  510. Case 3
  511. SendData "HALT"
  512. Case 4
  513. SendData "STOP"
  514. Case 5
  515. SendData "REPE"
  516. Case 6
  517. SendData "SHUF"
  518. Case 7
  519. SendData "CLER"
  520. Case 8
  521. SendData "VISA"
  522. Case 9
  523. SendData "GBEG"
  524. Case 10
  525. SendData "GEND"
  526. End Select
  527. End Sub
  528. Private Sub cmdaddfile_Click()
  529. SendData "AFLE" & txtselfile
  530. End Sub
  531. Private Sub cmdCloseRW_Click()
  532. SendData "CLOS"
  533. Timer2.Enabled = False
  534. Me.Caption = "Status: Disconnected"
  535. End Sub
  536. Private Sub cmdDownload_Click()
  537. frmMain.Show
  538. frmMain.txtfilename = lstfiles.Text
  539. SendData "REQU" & txtselfile
  540. End Sub
  541. Private Sub cmdfind_Click()
  542. frmfindfiles.FillinFields txtselfile
  543. 'frmfindfiles.Visible = True
  544. frmfindfiles.Show , Me
  545. End Sub
  546. Private Sub cmdIPScan_Click()
  547. frmIpScanner.Show , Me
  548. End Sub
  549. Private Sub cmdPauseTrans_Click()
  550. If Timer2.Enabled = True Then
  551. Timer2.Enabled = False
  552. cmdPauseTrans.Caption = "Resume Tansmitting Signals without Disconnection"
  553. Timer2.Enabled = True
  554. cmdPauseTrans.Caption = "Pause Tansmitting Signals without Disconnection"
  555. End If
  556. End Sub
  557. Private Sub cmdshowPlaylist_Click()
  558. SendData "GPLS"
  559. 'frmplaylist.Visible = True
  560. frmplaylist.Show , Me
  561. End Sub
  562. Private Sub cmdTerminateCL_Click()
  563. Unload Me
  564. End Sub
  565. Private Sub Command10_Click()
  566. SendData "RESW"
  567. End Sub
  568. Private Sub cmdReplace_Click()
  569. SendData "LFLE" & txtselfile
  570. End Sub
  571. Private Sub Command3_Click()
  572. Dim X As String
  573. X = InputBox("Modify winamp's path in the server-side?" & vbCrLf & "Press the cancel button if winamp is already working!" & vbCrLf & "Setting the wrong path may cause the server-computer to crash!" & vbCrLf & "" & vbCrLf & "(Use the built-in browser to find the winamp.exe file)", "Modify Server-Side Winamp Path", winamppath)
  574. If X = "" Then Exit Sub
  575. winamppath = X
  576. SendData "WAMP" & winamppath
  577. End Sub
  578. Private Sub Command4_Click()
  579. SendData "CLSW"
  580. End Sub
  581. Private Sub cmdBrowse_Click()
  582. If Right(txtselfile, 1) <> "\" Then
  583.     MsgBox "Add a \ behind the path you entered!", vbCritical, "Element missing!"
  584.     Exit Sub
  585. End If
  586. SendData "BRWD" & Replace(txtselfile & "\" & cmbFiletype.Text, "\\", "\")
  587. End Sub
  588. Private Sub Command6_Click()
  589. If Command6.Caption = "&Connect" Then
  590. Timer2.Enabled = False
  591. Winsock1.Close
  592. Timer2.Enabled = True
  593. Winsock1.Connect txtIP, DefPort
  594. Timer2.Enabled = False
  595. Winsock1.Close
  596. Winsock1.RemoteHost = ""
  597. Winsock1.RemotePort = 0
  598. Winsock1.LocalPort = 0
  599. Me.Caption = "Status: Disconnected"
  600. Command6.Caption = "&Connect"
  601. PlNum = "0"
  602. SongName = "??"
  603. songtime = "0"
  604. End If
  605. End Sub
  606. Private Sub Command8_Click()
  607. sldBal.Value = 128
  608. End Sub
  609. Private Sub Command9_Click()
  610. SendData "MINW"
  611. End Sub
  612. Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
  613. If Shift = vbShiftMask Or vbAltMask Or vbCtrlMask Then
  614.     If KeyCode = vbKeyC Then
  615.         SendData "CHSS"
  616.     End If
  617. End If
  618. End Sub
  619. Private Sub Form_Load()
  620. On Error Resume Next
  621. winamppath = GetSetting("RWClient", "REMOTEWINAMP", "WinampPath", "")
  622. txtIP = GetSetting("RWClient", "REMOTEWINAMP", "IP", "127.0.0.1")
  623. cmbdblclick.ListIndex = GetSetting("RWClient", "REMOTEWINAMP", "DoubleClick", 0)
  624. load_icon pictray, Me.Icon, "Remote Winamp - Client"
  625. End Sub
  626. Private Sub Form_Unload(Cancel As Integer)
  627. SaveSetting "RWClient", "REMOTEWINAMP", "WinampPath", winamppath
  628. SaveSetting "RWClient", "REMOTEWINAMP", "IP", txtIP
  629. SaveSetting "RWClient", "REMOTEWINAMP", "DoubleClick", cmbdblclick.ListIndex
  630. Unload_Icon pictray
  631. End Sub
  632. Private Sub lstfiles_Click()
  633. If Mid(lstfiles.Tag & lstfiles.List(lstfiles.ListIndex), 2) = ":\..\" Then
  634. txtselfile = ""
  635. txtselfile = lstfiles.Tag & lstfiles.List(lstfiles.ListIndex)
  636. End If
  637. End Sub
  638. Private Sub lstfiles_DblClick()
  639. If Mid(lstfiles.Tag & lstfiles.List(lstfiles.ListIndex), 2) = ":\..\" Then
  640. txtselfile = ""
  641. txtselfile = lstfiles.Tag & lstfiles.List(lstfiles.ListIndex)
  642. End If
  643. Select Case cmbdblclick.ListIndex
  644. Case 0  'Browse
  645. If Right(txtselfile, 1) <> "\" Then
  646.     MsgBox "Invalid Directory!", vbCritical, "Error"
  647.     Exit Sub
  648. End If
  649. SendData "BRWD" & Replace(txtselfile & "\" & cmbFiletype.Text, "\\", "\")
  650. Case 1 'Add
  651. cmdaddfile_Click
  652. Case 2 'Replace
  653. cmdReplace_Click
  654. End Select
  655. End Sub
  656. Private Sub pictray_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  657. On Error GoTo errhand
  658. Dim msg As Long
  659.     msg = X / Screen.TwipsPerPixelX
  660.         Select Case msg
  661.             Case WM_LBUTTONDBLCLK:
  662.             Case WM_LBUTTONDOWN:
  663.             Case WM_LBUTTONUP
  664.             Me.Visible = Not Me.Visible
  665.             Case WM_RBUTTONDBLCLK:
  666.             Case WM_RBUTTONDOWN:
  667.             Case WM_RBUTTONUP:
  668.             Me.Visible = Not Me.Visible
  669.         End Select
  670. errhand:
  671. End Sub
  672. Private Sub sldVol_Change()
  673. Call sldVol_Scroll
  674. End Sub
  675. Private Sub sldVol_Scroll()
  676. SendData "VOLU" & sldVol.Value
  677. End Sub
  678. Private Sub sldBal_Change()
  679. Call sldBal_Scroll
  680. End Sub
  681. Private Sub sldBal_Scroll()
  682. 'Dim prcnt As Long
  683. SendData "BALN" & sldBal.Value
  684. 'prcnt = Int((sldBal.Value - 127) / 1.27)
  685. 'If prcnt = 0 Then
  686. '    Timer1.Enabled = True
  687. 'Else
  688. '    lrstatus = ""
  689. '    Timer1.Enabled = False
  690. 'End If
  691. End Sub
  692. 'Private Sub Timer1_Timer()
  693. 'If lrstatus.Caption <> "" Then
  694. 'lrstatus.Caption = ""
  695. 'Timer1.Enabled = False
  696. 'End If
  697. 'End Sub
  698. Private Sub Timer2_Timer()
  699. Static times As Byte
  700. times = times + 1
  701. If times = 5 Then
  702. SendData ("SNIN")
  703. times = 0
  704. If songtime > 0 Then
  705. songtime = songtime
  706. 'Me.Caption = (PlNum + 1) & "\" & PlTot & " " & cms(CSng(songtime / 1000)) & "   " & SongName
  707. Me.Caption = (PlNum + 1) & ". " & SongName & " - [" & cms(CSng(songtime / 1000)) & "]"
  708. End If
  709. End If
  710. End Sub
  711. Private Sub txtIP_GotFocus()
  712. Command6.Default = True
  713. End Sub
  714. Private Sub txtselfile_GotFocus()
  715. cmdBrowse.Default = True
  716. End Sub
  717. Private Sub Winsock1_Close()
  718. Timer2.Enabled = False
  719. Winsock1.Close
  720. End Sub
  721. Private Sub Winsock1_Connect()
  722. Timer2.Enabled = True
  723. Me.Caption = "Status: Connected"
  724. Command6.Caption = "Dis&connect"
  725. End Sub
  726. Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
  727. On Error GoTo errhand
  728. Dim newdata As String, Linestart As Long, linedata As String
  729. Static lastData As String
  730. Winsock1.PeekData newdata, vbString
  731. If InStr(1, newdata, Chr(1)) = 0 Then
  732.     Exit Sub
  733. End If
  734. Winsock1.GetData newdata, vbString
  735. '//Logdata newdata
  736. again: Linestart = InStr(1, newdata, Chr(1))
  737. If Linestart <> 0 Then
  738. linedata = Mid(newdata, 1, Linestart - 1)
  739. newdata = Mid(newdata, Linestart + 1)
  740. ProcessData linedata
  741. lastData = newdata
  742. newdata = ""
  743. End If
  744. If newdata <> "" And newdata <> Chr(1) Then GoTo again
  745. Exit Sub
  746. errhand:
  747. MsgBox Err.Number & vbCrLf & Err.Description, , "Winsock1_DataArrival"
  748. End Sub
  749. Private Sub ProcessData(linedata As String)
  750. Dim datatype As String, data As String
  751. Dim t As Integer, shortname As String
  752. Dim pathItems() As String
  753. datatype = Left(linedata, 4)
  754. data = Mid(linedata, 5)
  755. Select Case UCase(datatype)
  756. Case "DIRI" 'directory info
  757. pathItems = Split(data, "|")
  758. lstfiles.Clear
  759. If IsNumeric(pathItems(0)) = True Then
  760. lstfiles.Tag = ""
  761. lstfiles.AddItem "ERROR#" & pathItems(0)
  762. lstfiles.AddItem pathItems(1)
  763. lstfiles.AddItem pathItems(2)
  764. lstfiles.AddItem pathItems(3)
  765. lstfiles.Tag = pathItems(0)
  766. For t = 1 To UBound(pathItems)
  767.     lstfiles.AddItem pathItems(t)
  768. Next t
  769. End If
  770. Case "SNIN"
  771. 'data=SongTime|TrkNum|#Trk|SongTitle
  772. 'where | is CHr(3)
  773. pathItems = Split(data, Chr(3), 4)
  774. 'Me.Caption = (pathItems(1) + 1) & "\" & pathItems(2) & " " & cms(CSng(pathItems(0) / 1000)) & "   " & pathItems(3)
  775. PlNum = pathItems(1)
  776. PlTot = pathItems(2)
  777. songtime = pathItems(0)
  778. SongName = pathItems(3)
  779. Case "CLRP"
  780. Case "PLSE"
  781. Case "FIND"
  782. 'data: filename(LB)Filename(LB)...
  783. pathItems = Split(data, vbCrLf)
  784. For t = 0 To UBound(pathItems)
  785. frmfindfiles.lstfoundfiles.AddItem pathItems(t), 0
  786. Next t
  787. Case "GPLS"
  788. 'Data=Playlist Entry#1(LB)PLS Entry#2(LB)...
  789. pathItems = Split(data, vbCrLf)
  790. frmplaylist.lstpls.Clear
  791. For t = 0 To UBound(pathItems)
  792.     If pathItems(t) <> "" Then
  793.         shortname = RemoveParent(pathItems(t))
  794.         If t + 1 < 10 Then
  795.             pathItems(t) = "   " & t + 1 & ".  " & pathItems(t)
  796.         ElseIf t + 1 < 100 Then
  797.             pathItems(t) = "  " & t + 1 & ".  " & pathItems(t)
  798.         ElseIf t + 1 < 1000 Then
  799.             pathItems(t) = " " & t + 1 & ".  " & pathItems(t)
  800.         Else
  801.             pathItems(t) = t + 1 & ".  " & pathItems(t)
  802.         End If
  803.         frmplaylist.lstpls.AddItem pathItems(t)
  804.         If t + 1 < 10 Then
  805.             pathItems(t) = "   " & t + 1 & ".  " & shortname
  806.         ElseIf t + 1 < 100 Then
  807.             pathItems(t) = "  " & t + 1 & ".  " & shortname
  808.         ElseIf t + 1 < 1000 Then
  809.             pathItems(t) = " " & t + 1 & ".  " & shortname
  810.         Else
  811.             pathItems(t) = t + 1 & ".  " & shortname
  812.         End If
  813.         frmplaylist.lstshortpls.AddItem pathItems(t)
  814.     End If
  815. Next t
  816. End Select
  817. End Sub
  818. Sub SendData(data As String)
  819. If Winsock1.State = sckConnected Then
  820. Winsock1.SendData data & Chr(1)
  821. End If
  822. End Sub
  823. Private Sub Form_Initialize()
  824.     InitCommonControls
  825. End Sub
  826.